<form class="layui-form">
  <input type="hidden" name="s_id" value="<{$info['id']}>">
  <input type="hidden" name="id" value="<{$id}>">
  <div class="layui-form-item">
    <label class="layui-form-label">推荐用户</label>
    <div class="layui-input-block">
      <input type="text" name="user_no" value="<{$info['user_no']}>" onchange="getInfo()" placeholder="请输入推荐编号" autocomplete="off" class="layui-input">
      <span name='s_name' style="color:red;"><{$info['name']}></span>
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit="" lay-filter="form">立即提交</button>
    </div>
  </div>
</form>

<script>
  function getInfo(){
    var user_no   = $('[name="user_no"]').val();
    var layer = layui.layer;
    $.ajax({
      url: "<{:url('user/getInfo')}>",
      type: 'POST',
      dataType: 'json',
      data: { user_no:user_no },
    })
    .done(function(rs) {
      if (rs.r === 0) {
        $('[name="s_id"]').val(rs.data.id);
        $('[name="user_no"]').val(rs.data.user_no);
        $('[name="s_name"]').text(rs.data.name);
      }else{
        $('[name="s_id"]').val('');
        $('[name="user_no"]').val('');
        $('[name="s_name"]').text('');
        layer.msg('用户错误',{icon:5});
      }
    })
    .fail(function() {
      console.log("网络错误");
    });
  }
</script>